#ifndef ADVDSPROFILE_NVRAM_HPP
#define ADVDSPROFILE_NVRAM_HPP

#include <3ds.h>
#include <cpp3ds/System/String.hpp>
#include <cpp3ds/Graphics/Color.hpp>

namespace AdvDSProfile
{

class NVRAM {

public:
  static NVRAM& getInstance();

  cpp3ds::Uint32 getNVRAMActiveBlock();

  Result readUsername(cpp3ds::String *usernameOut);
  Result writeUsername(cpp3ds::String usernameIn);

  Result readMessage(cpp3ds::String *messageOut);
  Result writeMessage(cpp3ds::String messageIn);

  Result readBirthday(int *birthdayDayOut, int *birthdayMonthOut);
  Result writeBirthdayMonth(int birthdayMonthIn);
  Result writeBirthdayDay(int birthdayDayIn);

  Result readTheme(cpp3ds::Color *colorOut, int *indexOut);
  Result writeTheme(int themeIn);

private:
  Result nvramInit();
  Result nvramExit();

  Result writeCRC(cpp3ds::Uint32 activeBlockAddress);

};

} // namespace AdvDSProfile

#endif // ADVDSPROFILE_NVRAM_HPP
